
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>发表问题 编辑问题 公用</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="keywords" content="fly,layui,前端社区">
  <meta name="description" content="Fly社区是模块化前端UI框架Layui的官网社区，致力于为web开发提供强劲动力">
  <link rel="stylesheet" href="../../res/layui/css/layui.css">
  <link rel="stylesheet" href="../../res/css/global.css">
</head>
<body>
<style>
  .layui-input-block .roomname {
    height: 34px;
  }
</style>
<div class="fly-header layui-bg-black">
  <div class="layui-container">
    <a class="fly-logo" href="/">
      <img src="../../res/images/logo.png" alt="layui">
    </a>
    
    <ul class="layui-nav fly-nav-user">
      
      
      <!-- 登入后的状态 -->
      <li class="layui-nav-item">
        <a class="fly-nav-avatar" href="javascript:;">
          <cite class="layui-hide-xs" id="user-name"></cite>
          <i class="iconfont icon-renzheng layui-hide-xs" title="认证信息：layui 作者"></i>
          <i class="layui-badge fly-badge-vip layui-hide-xs">VIP3</i>
          <img src="https://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg">
        </a>
        <dl class="layui-nav-child">
          <dd><a href="../user/set.html"><i class="layui-icon">&#xe620;</i>基本设置</a></dd>
          <dd><a href="../user/message.html"><i class="iconfont icon-tongzhi" style="top: 4px;"></i>我的消息</a></dd>
          <dd><a href="../user/home.html"><i class="layui-icon" style="margin-left: 2px; font-size: 22px;">&#xe68e;</i>我的主页</a></dd>
          <hr style="margin: 5px 0;">
          <dd><a href="" style="text-align: center;">退出</a></dd>
        </dl>
      </li>
    </ul>
  </div>
</div>

<div class="layui-container fly-marginTop">
  <div class="fly-panel" pad20 style="padding-top: 5px;">
    <div class="layui-form layui-form-pane">
      <div class="layui-tab layui-tab-brief" lay-filter="user">
        <ul class="layui-tab-title">
          <li class="layui-this">创建新局</li>
        </ul>
        <div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">
          <div class="layui-tab-item layui-show">
            <form action="" method="post">

              <div class="layui-form-item">
                <label class="layui-form-label">房间名称</label>
                <div class="layui-input-block">
                  <input type="text" class="roomname" name="roomname">
                </div>
              </div>

              <div class="layui-form-item">
                <label class="layui-form-label">我方执子</label>
                <div class="layui-input-block">
                  <input type="radio" name="color" value="H" title="黑" checked>
                  <input type="radio" name="color" value="B" title="白">
                </div>
              </div>

              <div class="layui-form-item">
                <label class="layui-form-label">棋盘大小</label>
                <div class="layui-input-block">
                  <select name="chessSize" lay-verify="required">
                    <option value="19">十九路</option>
                    <option value="13">十三路</option>
                    <option value="9">九路</option>
                  </select>
                </div>
              </div>

              <div class="layui-form-item">
                <label class="layui-form-label">白方让子</label>
                <div class="layui-input-block">
                  <select name="letNum" lay-verify="required">
                    <option value="0">不让子</option>
                    <option value="2">让二子</option>
                    <option value="3">让三子</option>
                    <option value="4">让四子</option>
                    <option value="5">让五子</option>
                    <option value="6">让六子</option>
                    <option value="7">让七子</option>
                    <option value="8">让八子</option>
                    <option value="9">让九子</option>
                  </select>
                </div>
              </div>

              <div class="layui-form-item">
                <button class="layui-btn" lay-filter="create" lay-submit>立即创建</button>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

<script src="../../res/layui/layui.js"></script>
<script>
layui.cache.page = 'jie';
layui.cache.user = {
  username: '游客'
  ,uid: -1
  ,avatar: '../../res/images/avatar/00.jpg'
  ,experience: 83
  ,sex: '男'
};
layui.config({
  version: "3.0.0"
  ,base: '../../res/mods/'
}).extend({
  fly: 'index'
}).use('fly');
</script>
<script>
layui.use(['form', 'ajax'], function() {
  var form = layui.form;
  var ajax = layui.ajax;
  form.on('submit(create)', function(data) {
    ajax({
      url: '/room/creatRoom',
      method: 'get',
      data: {
        roomname: data.field.roomname,
        chessSize: data.field.chessSize,
        letNum: data.field.letNum,
        color: data.field.color
      },
      success: function(res) {
        // window.location.href = '/html/index.html';
        window.history.back();
      }
    });
    return false;
  });
});

</script>
</body>
</html>